home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PRIVATE.ZIP / _SCROPEN.C < prev    next >
Text File  |  1992-11-21  |  4KB  |  96 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3.  
  4. #ifndef        NDEBUG
  5. char *rcsid__scropen = "$Header: c:/curses/private/RCS/_scropen.c%v 2.0 1992/11/15 03:24:35 MH Rel $";
  6. #endif
  7.  
  8.  
  9.  
  10.  
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_scr_open()       - Internal low-level binding to open the physical screen
  14.  
  15.   PDCurses Description:
  16.        This function provides a low-level binding for the Flexos
  17.        platform which must open the screen before writing to it.
  18.  
  19.        This function is provided in order to access the FlexOS 16 bit
  20.        character set for input rather than the limited input
  21.        character set associated with the VT52.
  22.  
  23.   PDCurses Return Value:
  24.        This function returns OK on success, otherwise an ERR is returned.
  25.  
  26.   PDCurses Errors:
  27.        The DOS platform will never fail.  The Flexos platform may fail
  28.        depending on the ability to open the current virtual console in
  29.        8 (as opposed to 16) bit mode.
  30.  
  31.   Portability:
  32.        PDCurses        int     PDC_scr_open( SCREEN* internal, bool echo );
  33.  
  34. **man-end**********************************************************************/
  35.  
  36. int    PDC_scr_open(SCREEN *internal, bool echo)
  37. {
  38. #ifdef FLEXOS
  39.        retcode = s_get(T_VIRCON, 0L, (char *) &vir, (long) sizeof(vir));
  40.        if (retcode < 0L)
  41.                return( ERR );
  42.  
  43.        kbmode = vir.vc_kbmode;
  44.        cmode = vir.vc_mode;
  45.        vir.vc_mode = 0;
  46.  
  47.        if (!echo)      vir.vc_kbmode |= VCKM_NECHO;
  48.        else            vir.vc_kbmode &= ~VCKM_NECHO;
  49.  
  50.        smode = vir.vc_smode;
  51.        retcode = s_set(T_VIRCON, 0L, (char *) &vir, (long) sizeof(vir));
  52.        if  (retcode < 0L)
  53.                return( ERR );
  54.  
  55.        if (vir.vc_type & 0x03) internal->mono = TRUE;
  56.        else                    internal->mono = FALSE;
  57.  
  58.        internal->orig_attr = vir.vc_flcolor | vir.vc_blcolor;
  59.        _flexos_16bitmode();
  60. #endif
  61.  
  62. #ifdef DOS
  63.        char far *INFO = (char far *) 0x0487L;
  64.  
  65.        internal->orig_attr      = 0;
  66.        internal->orig_emulation = *INFO;
  67. #endif
  68. #ifdef OS2
  69.        internal->orig_attr      = 0;
  70.        internal->orig_emulation = 0;
  71. #endif
  72.  
  73.        PDC_get_cursor_pos(&internal->cursrow, &internal->curscol);
  74.        internal->autocr        = TRUE;         /* lf -> crlf by default      */
  75.        internal->raw_out       = FALSE;        /* tty I/O modes              */
  76.        internal->raw_inp       = FALSE;        /* tty I/O modes              */
  77.        internal->cbreak        = FALSE;
  78.        internal->echo          = echo;
  79.        internal->refrbrk       = FALSE;        /* no premature end of refresh*/
  80. #if !defined OS2
  81.        internal->video_seg     = 0xb000;       /* Base screen segment addr   */
  82.        internal->video_ofs     = 0x0;          /* Base screen segment ofs    */
  83. #endif
  84.        internal->video_page    = 0;            /* Current Video Page         */
  85.        internal->direct_video  = TRUE;         /* Assume that we can         */
  86.        internal->visible_cursor= TRUE;         /* Assume that it is visible  */
  87.        internal->cursor        = PDC_get_cursor_mode();
  88.        internal->adapter       = PDC_query_adapter_type();
  89.        internal->font          = PDC_get_font();
  90.        internal->scrnmode      = PDC_get_scrn_mode();
  91.        internal->lines         = PDC_get_rows();
  92.        internal->cols          = PDC_get_columns();
  93.        internal->audible       = TRUE;
  94.        return( OK );
  95. }
  96.